/**
 * 菜单配置
 */
import { axios } from '@/utils/request'
import store from '@/store'

const hardcodeUrl = ''

const api = {
  perm: 'mos/authority/perm',
  action: 'mos/authority/action'
}

/**
 * 获取所有菜单的权限
 * @param {*} params
 */
export function getPermList (params) {
  return axios({
    url: api.perm + '/list',
    method: 'get',
    params
  })
}

/**
 * 创建菜单权限
 * @param {Object} data
 */
export function createPerm (data) {
  return axios({
    url: api.perm,
    method: 'post',
    data
  })
}

/**
 * 修改菜单权限
 * @param {*} data
 */
export function updatePerm (data) {
  return axios({
    url: api.perm,
    method: 'put',
    data
  })
}

/**
 * 删除菜单的权限
 * @param {*} params
 */
export function deletePerm (params) {
  return axios({
    url: api.perm,
    method: 'delete',
    params
  })
}

/**
 * 修改菜单权限
 * @param {*} data
 */
export function startOrBanPerm (data) {
  return axios({
    url: api.perm + '/updatePermStatus',
    method: 'put',
    data
  })
}

/**
 * 绑定操作
 * @param {*} data
 */
export function bindAction (data) {
  return axios({
    url: api.perm + '/updatePermAndAction',
    method: 'put',
    data
  })
}

/**
 * 获取动作列表
 * @param {*} params
 */
export function getActionList (params) {
  return axios({
    url: api.action + '/list',
    method: 'get',
    params
  })
}

/**
 * 新建动作
 * @param {*} data
 */
export function createAction (data) {
  return axios({
    url: api.action,
    method: 'post',
    data
  })
}

/**
 * 编辑动作
 * @param {*} data
 */
export function updateAction (data) {
  return axios({
    url: api.action,
    method: 'put',
    data
  })
}

/**
 * 删除动作
 * @param {*} params
 */
export function deleteAction (params) {
  return axios({
    url: api.action,
    method: 'delete',
    params
  })
}
